import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 栏目类型信息 */
export interface ColumnType {
  id: number // 栏目类型id
  columns?: string // 栏目
  columnName?: string // 栏目名称
  status?: number // 非会员是都查看（0可查看 1不可查看）
  category: string // 所属分类
  registrationFields: string // 报名字段
}

// 栏目类型 API
export const ColumnTypeApi = {
  // 查询栏目类型分页
  getColumnTypePage: async (params: any) => {
    return await request.get({ url: `/biz/column-type/page`, params })
  },

  // 查询栏目类型详情
  getColumnType: async (id: number) => {
    return await request.get({ url: `/biz/column-type/get?id=` + id })
  },

  // 新增栏目类型
  createColumnType: async (data: ColumnType) => {
    return await request.post({ url: `/biz/column-type/create`, data })
  },

  // 修改栏目类型
  updateColumnType: async (data: ColumnType) => {
    return await request.put({ url: `/biz/column-type/update`, data })
  },

  // 删除栏目类型
  deleteColumnType: async (id: number) => {
    return await request.delete({ url: `/biz/column-type/delete?id=` + id })
  },

  /** 批量删除栏目类型 */
  deleteColumnTypeList: async (ids: number[]) => {
    return await request.delete({ url: `/biz/column-type/delete-list?ids=${ids.join(',')}` })
  },

  // 导出栏目类型 Excel
  exportColumnType: async (params) => {
    return await request.download({ url: `/biz/column-type/export-excel`, params })
  }
}
